PD · LGD · EAD · Credit VaR · ECL · CVA

Credit risk analytics.Python. Real data.

A rigorous handbook and runnable Python suite for learning, teaching, validating, and prototyping modern credit risk workflows—from a single exposure to portfolio loss and counterparty risk.

71-page PDF LaTeX equations Executed examples Public-data snapshots
Credit Risk Analytics with Python handbook cover
FREE71-page handbook
28Handbook chapters
18Guided labs
37Passing tests
5Public data families
MITCode license
One coherent learning system

The theory, the equations, and the implementation.

Built as a connected reference—not a folder of unrelated snippets. The handbook explains each model, the labs make it run, and the package turns the calculations into reusable components.

ƒ

Formula-first handbook

Clean equations, assumptions, worked interpretation, and risk-manager language for PD, LGD, EAD, EL/UL, capital, migration, CVA, and ECL.

>_

Runnable Python labs

An end-to-end workflow plus 18 guided labs. Execute them as scripts or in notebook-aware editors and inspect every intermediate result.

◇

Reusable package

Installable modules for portfolio loss, PD, LGD, EAD, dependence, stress, IFRS 9, ratings, credit derivatives, and counterparty risk.

✓

Validation built in

Discrimination, calibration, stability, drift, numerical tests, data contracts, and reproducible run manifests support review—not just model fitting.

⎇

Production-shaped workflow

Snapshot inputs, reconcile balances, separate calibration from application, document overrides, preserve evidence, and respect change controls.

◎

Teaching resources

Course mapping, exercises, solutions, assignments, rubrics, formula reference, cookbook, and a full glossary for classroom or self-study.

Observed public data

No “real-world” label pasted onto synthetic rows.

The suite bundles dated, offline snapshots from authoritative public sources so examples remain reproducible while students learn proper provenance, metadata, licensing, and as-of discipline.

Transparent boundary: where obligor-level workout, limit-utilization, or internal rating histories are not publicly available, the package labels those teaching records as fictional. It never presents them as bank data.
Statlog German CreditObserved borrower and loan characteristics
1,000 rows
US High-Yield OASMarket-implied credit conditions and spreads
792 rows
Credit-cycle indicatorsDelinquencies, charge-offs, lending conditions
9,716 rows
World Bank macro indicatorsScenario and sovereign context variables
360 rows
ECB foreign-exchange observationsMarket inputs for exposure and scenario work
7,169 rows
A professional workflow

From raw evidence to a defendable risk result.

The sequence mirrors how mature risk teams separate data, methodology, validation, scenario application, reporting, and governance.

01

Define & freeze

Start with target definitions, observation windows, defaults, cures, recoveries, and a dated source snapshot.

  • Data dictionary and provenance
  • Leakage and cohort controls
  • EAD reconciliation
02

Estimate & calibrate

Develop transparent benchmark models, then calibrate to documented long-run, point-in-time, or downturn targets.

  • Scorecards and logistic PD
  • Workout LGD and CCF/EAD
  • Migration and hazard curves
03

Challenge & stress

Test more than headline accuracy: calibration, stability, concentration, tail behavior, sensitivity, and limitations all matter.

  • Discrimination and calibration
  • Drift and stability metrics
  • Scenario and reverse stress
04

Evidence & govern

Preserve reproducible outputs and distinguish model results from overlays, policy rules, and expert decisions.

  • Cryptographic run manifest
  • Aggregates and controls
  • Approval and change record

Equations you can trace into code.

Every core relationship is explained in the handbook and mirrored by transparent Python—not hidden behind a black-box API.

Expected loss
EL = PD × LGD × EAD

The starting identity for pricing, provisioning, portfolio analysis, and control reconciliation.

Vasicek conditional PD
p(z) = Φ[(Φ⁻¹(p) − √ρz) / √(1−ρ)]

A compact bridge from obligor default risk to systematic-factor portfolio loss.

CVA approximation
CVA ≈ (1−R) Σ DF(t) · EE(t) · ΔPD(t)

Connects discounted expected exposure, default increments, and recovery assumptions.

Built for three audiences

One package. Three ways to use it.

Read it linearly as a course, teach it as a structured module, or use individual components as transparent benchmark and challenger implementations.

Students

Learn the model and the code together.

Move from credit-risk foundations to advanced portfolio methods without losing the intuition behind the equations.

Start with the free handbook →
Professors

Teach from reproducible material.

Use the course map, guided labs, exercises, formula reference, and transparent datasets for demonstrations and assignments.

See the complete teaching pack →
Practitioners

Prototype with workplace discipline.

Adapt tested building blocks for training, benchmarking, challenger work, and method review within your institution's controls.

Inspect the premium code suite →
Comprehensive coverage

From the first EL formula to portfolio engines.

The handbook integrates the original Measurement of Credit Risk syllabus with advanced institutional topics from model development, markets, counterparty risk, and governance.

01Loss distributions, EL & UL
02PD estimation & calibration
03Workout LGD & downturn concepts
04EAD, CCF & credit lines
05Dependence, copulas & simulation
06Credit VaR, ES & capital
07Stress testing & reverse stress
08IFRS 9 ECL & staging
09Ratings, migration & hazard curves
10CDS, spreads & bond basis
11Structural models & distance to default
12Counterparty exposure, PFE & collateral
13CVA, DVA & wrong-way risk
14Vasicek & CreditRisk+
15CreditMetrics migration VaR
16Validation, monitoring & governance
Start now

Read the handbook free. Buy the professional package when you're ready.

The PDF is the free learning edition. The premium suite is a separate paid product containing the installable package, real-data snapshots, guided labs, tests, configurations, documentation, and reproducible examples behind the book.

Clear offer: the handbook is free; the complete Python code suite is sold separately as a professional package.